package com.symone.webcms.model;

import java.io.Serializable;

import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotations.Version;

import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;

/**
 *   @description : ScheduleTask 实体类
 *   ---------------------------------
 * 	 @author Archer Chu
 *   @since 2019-04-04
 */
@Data
@Accessors(chain = true)
@TableName("sys_schedule_task")
public class ScheduleTask extends Model<ScheduleTask> {

    private static final long serialVersionUID = 1L;

	public static final String STATUS_RUNNING = "1";
	public static final String STATUS_NOT_RUNNING = "0";
	public static final String STATUS_DELETED = "2";
	public static final Integer CONCURRENT_IS = 1;
	public static final Integer CONCURRENT_NOT = 0;

	@TableId(value="id", type= IdType.AUTO)
	private Long id;
	private String name;
	private String group;
	private String status;
	@TableField("is_concurrent")
	private Integer isConcurrent;
	private String cron;
	private String description;
	@TableField("spring_id")
	private String springId;
	@TableField("class_name")
	private String className;
	@TableField("method_name")
	private String methodName;
	@TableField("start_time")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date startTime;
	@TableField("previous_time")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date previousTime;
	@TableField("next_time")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date nextTime;
	@TableField("create_time")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createTime;
	@TableField("create_user")
	private String createUser;
	@TableField("update_time")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date updateTime;
	@TableField("update_user")
	private String updateUser;


	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder(120);
		sb.append("QuartzJobBean [jobId=").append(id).append(", jobName=").append(name)
				.append(", jobGroup=").append(group).append(", jobStatus=").append(status)
				.append(", isConcurrent=").append(isConcurrent).append(", cronExpression=").append(cron)
				.append(", jobClass=").append(className).append(", methodName=").append(methodName).append("]");
		return sb.toString();
	}

	@Override
	public int hashCode() {
		int hash = 7;
		hash = 31 * hash + name.hashCode();
		hash = 31 * hash + group.hashCode();
		return hash;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj == null || (obj.getClass() != this.getClass())) {
			return false;
		}
		ScheduleTask oBean = (ScheduleTask) obj;
		if(this.name.equals(oBean.name) && this.group.equals(oBean.group)) {
			return true;
		}
		return false;
	}
}
